package cubelabs.nexus.dao;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import cubelabs.nexus.entity.Review;
import cubelabs.nexus.entity.User;

@Repository("reviewDAO")
public class ReviewDAO extends BaseDAO<Review, Long>{

	public Review findByUser(User user){
		Criteria crit = getSession().createCriteria(getPersistentClass());
		crit.add(Restrictions.eq("user", user));
		Review review = (Review) crit.uniqueResult();
		return review;
	}
}
